<?php

namespace app\index\controller;
use think\Db as directionDB;

class ResearchDirection extends Common{
    public $datas;


    /**
     * 查询研究方向
     */
    public function getResearchDirection(){
        $this->datas = $this->params;

        $condition = "";
        if(!empty($this->datas['text'])){
            $condition .= " WHERE text like '%".$this->datas['text']."%' ";
        }
        try {
            $sql = "SELECT text FROM research_direction ".$condition;
            $result = directionDB::query($sql);

            if(empty($result)){
                $this->returnMsg(1, '暂无数据！');
            }

            $this->returnMsg(1, '获取数据成功！', $result);
        }catch (Exception $e){
            echo $e->getMessage();
        }
    }
}